Skip to content

[MusicXML] improve title box position#33373

Merged
RomanPudashkin merged 4 commits into
musescore:mainfrom
rettinghaus:xml/vbox
May 15, 2026
Merged

[MusicXML] improve title box position#33373
RomanPudashkin merged 4 commits into
musescore:mainfrom
rettinghaus:xml/vbox

Conversation

@rettinghaus
Copy link
Copy Markdown
Contributor

This rounds the default-x and default-y positions of the title vbox on export for greater stability on import and export.

Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 12, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a666404a-a42f-42e0-852e-b77fde8bd194

📥 Commits

Reviewing files that changed from the base of the PR and between aaa4bdf and 2e49a27.

📒 Files selected for processing (3)
  • src/importexport/musicxml/internal/export/exportmusicxml.cpp
  • src/importexport/musicxml/internal/import/importmusicxmlpass1.cpp
  • src/importexport/musicxml/tests/data/testSystemDistance_ref.xml
✅ Files skipped from review due to trivial changes (1)
  • src/importexport/musicxml/internal/export/exportmusicxml.cpp
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/importexport/musicxml/tests/data/testSystemDistance_ref.xml
  • src/importexport/musicxml/internal/import/importmusicxmlpass1.cpp

📝 Walkthrough

Walkthrough

This PR adjusts numeric precision and layout calculation in the MusicXML import/export path: exportmusicxml.cpp formats <credit> element default-x/default-y with two decimal places, and importmusicxmlpass1.cpp makes resizeTitleBox() use spatium-dependent padding when appropriate. Test reference XML was updated to match the export formatting change.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the change (rounding default-x/default-y positions) and its motivation (stability), but omits the required template sections like issue reference, CLA checkbox, and commit guidelines verification. Add the standard PR template sections including issue reference (Resolves: #NNNNN), CLA signature confirmation, and verification checkboxes for commit messages and code quality.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title '[MusicXML] improve title box position' clearly describes the main change of rounding title vbox positioning attributes for export stability.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/importexport/musicxml/internal/import/importmusicxmlpass1.cpp (1)

1004-1020: ⚠️ Potential issue | 🟠 Major

Use conditional spatium logic consistently on line 1020

Line 1004 conditionally selects the spatium source based on vbox->sizeIsSpatiumDependent(), but line 1020 unconditionally uses vbox->spatium() for the height-to-Spatium conversion. The padding calculation and height conversion must use the same spatium base.

Change line 1020 to:

const double sp = vbox->sizeIsSpatiumDependent() ? vbox->spatium() : vbox->style().defaultSpatium();
const auto height = Spatium::fromAbsolute(calculatedVBoxHeight, sp);

This pattern is consistent with similar conversions elsewhere in the codebase (e.g., box.cpp lines 106-108).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/importexport/musicxml/internal/import/importmusicxmlpass1.cpp` around
lines 1004 - 1020, The height conversion uses vbox->spatium() unconditionally
but padding above used vbox->sizeIsSpatiumDependent() to pick between
vbox->spatium() and vbox->style().defaultSpatium(); update the
Spatium::fromAbsolute call to use the same conditional spatium selection as the
padding calculation (compute a local sp variable via
vbox->sizeIsSpatiumDependent() ? vbox->spatium() :
vbox->style().defaultSpatium() and pass that to Spatium::fromAbsolute with
calculatedVBoxHeight), referencing vbox, calculatedVBoxHeight and
Spatium::fromAbsolute to locate the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/importexport/musicxml/internal/import/importmusicxmlpass1.cpp`:
- Line 1004: The variable padding is declared as int which truncates fractional
spatium values; change its type to double and assign it from
vbox->sizeIsSpatiumDependent() ? vbox->style().spatium() :
vbox->style().defaultSpatium() so the fractional precision from spatium() and
defaultSpatium() is preserved (update any downstream uses of padding to accept
double where necessary).

---

Outside diff comments:
In `@src/importexport/musicxml/internal/import/importmusicxmlpass1.cpp`:
- Around line 1004-1020: The height conversion uses vbox->spatium()
unconditionally but padding above used vbox->sizeIsSpatiumDependent() to pick
between vbox->spatium() and vbox->style().defaultSpatium(); update the
Spatium::fromAbsolute call to use the same conditional spatium selection as the
padding calculation (compute a local sp variable via
vbox->sizeIsSpatiumDependent() ? vbox->spatium() :
vbox->style().defaultSpatium() and pass that to Spatium::fromAbsolute with
calculatedVBoxHeight), referencing vbox, calculatedVBoxHeight and
Spatium::fromAbsolute to locate the change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 30a4d7c0-5820-4ad6-912f-f4a2adc5f617

📥 Commits

Reviewing files that changed from the base of the PR and between de0871b and 10b228d.

📒 Files selected for processing (3)
  • src/importexport/musicxml/internal/export/exportmusicxml.cpp
  • src/importexport/musicxml/internal/import/importmusicxmlpass1.cpp
  • src/importexport/musicxml/tests/data/testSystemDistance_ref.xml

Comment thread src/importexport/musicxml/internal/import/importmusicxmlpass1.cpp Outdated
@mathesoncalum mathesoncalum requested a review from miiizen May 13, 2026 08:07
Jojo-Schmitz added a commit to Jojo-Schmitz/MuseScore that referenced this pull request May 13, 2026
Backport of musescore#33373

Co-Authored-By: Klaus Rettinghaus <rettinghaus@users.noreply.github.com>
Jojo-Schmitz added a commit to Jojo-Schmitz/MuseScore that referenced this pull request May 13, 2026
Backport of musescore#33373

Co-Authored-By: Klaus Rettinghaus <rettinghaus@users.noreply.github.com>
Jojo-Schmitz added a commit to Jojo-Schmitz/MuseScore that referenced this pull request May 13, 2026
Backport of musescore#33373

Co-Authored-By: Klaus Rettinghaus <rettinghaus@users.noreply.github.com>
rettinghaus and others added 4 commits May 15, 2026 13:40
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@RomanPudashkin RomanPudashkin merged commit d578d25 into musescore:main May 15, 2026
14 checks passed
@rettinghaus rettinghaus deleted the xml/vbox branch May 15, 2026 14:56
@Jojo-Schmitz Jojo-Schmitz mentioned this pull request May 21, 2026
@github-project-automation github-project-automation Bot moved this from Done to Needs porting in MuseScore Studio 4.7.2 May 21, 2026
@RomanPudashkin RomanPudashkin moved this from Needs porting to Done in MuseScore Studio 4.7.2 May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants